/****** Object:  View [dbo].[vw_aspnet_Applications]    Script Date: 10/12/2009 10:07:11 ******/

GO
SET QUOTED_IDENTIFIER OFF
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_aspnet_Applications]'))
EXEC dbo.sp_executesql @statement = N'
  CREATE VIEW [dbo].[vw_aspnet_Applications]
  AS SELECT [ApplicationName], 
			[LoweredApplicationName], 
			[ApplicationId], 
			[Description]
  FROM [dbo].[aspnet_Applications]
  ' 
GO
/****** Object:  View [dbo].[vw_aspnet_MembershipUsers]    Script Date: 10/12/2009 10:07:11 ******/

GO
SET QUOTED_IDENTIFIER OFF
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_aspnet_MembershipUsers]'))
EXEC dbo.sp_executesql @statement = N'
  CREATE VIEW [dbo].[vw_aspnet_MembershipUsers]
  AS SELECT M.[UserId],
            M.[PasswordFormat],
            M.[MobilePIN],
            M.[Email],
            M.[LoweredEmail],
            M.[PasswordQuestion],
            M.[PasswordAnswer],
            M.[IsApproved],
            M.[IsLockedOut],
            M.[CreateDate],
            M.[LastLoginDate],
            M.[LastPasswordChangedDate],
            M.[LastLockoutDate],
            M.[FailedPasswordAttemptCount],
            M.[FailedPasswordAttemptWindowStart],
            M.[FailedPasswordAnswerAttemptCount],
            M.[FailedPasswordAnswerAttemptWindowStart],
            M.[Comment],
            U.[ApplicationId],
            U.[UserName],
            U.[MobileAlias],
            U.[IsAnonymous],
            U.[LastActivityDate]
  FROM [dbo].[aspnet_Membership] as M INNER JOIN [dbo].[aspnet_Users] as U
      ON M.[UserId] = U.[UserId]
  ' 
GO
/****** Object:  View [dbo].[vw_aspnet_Profiles]    Script Date: 10/12/2009 10:07:11 ******/

GO
SET QUOTED_IDENTIFIER OFF
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_aspnet_Profiles]'))
EXEC dbo.sp_executesql @statement = N'
  CREATE VIEW [dbo].[vw_aspnet_Profiles]
  AS SELECT [UserId], [LastUpdatedDate],
      [DataSize]=  DATALENGTH([PropertyNames])
                 + DATALENGTH([PropertyValuesString])
                 + DATALENGTH([PropertyValuesBinary])
  FROM [dbo].[aspnet_Profile]
  ' 
GO
/****** Object:  View [dbo].[vw_aspnet_Roles]    Script Date: 10/12/2009 10:07:11 ******/

GO
SET QUOTED_IDENTIFIER OFF
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_aspnet_Roles]'))
EXEC dbo.sp_executesql @statement = N'
  CREATE VIEW [dbo].[vw_aspnet_Roles]
  AS SELECT [ApplicationId], 
			[RoleId], 
			[RoleName], 
			[LoweredRoleName], 
			[Description]
  FROM [dbo].[aspnet_Roles]
  ' 
GO
/****** Object:  View [dbo].[vw_aspnet_Users]    Script Date: 10/12/2009 10:07:12 ******/

GO
SET QUOTED_IDENTIFIER OFF
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_aspnet_Users]'))
EXEC dbo.sp_executesql @statement = N'
  CREATE VIEW [dbo].[vw_aspnet_Users]
  AS SELECT U.[ApplicationId], 
			U.[UserId], 
			U.[UserName], 
			U.[LoweredUserName], 
			U.[MobileAlias], 
			U.[IsAnonymous], 
			U.[LastActivityDate]
  FROM [dbo].[aspnet_Users] as U
  ' 
GO
/****** Object:  View [dbo].[vw_aspnet_UsersInRoles]    Script Date: 10/12/2009 10:07:12 ******/

GO
SET QUOTED_IDENTIFIER OFF
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_aspnet_UsersInRoles]'))
EXEC dbo.sp_executesql @statement = N'
  CREATE VIEW [dbo].[vw_aspnet_UsersInRoles]
  AS SELECT [UserId], 
			[RoleId]
  FROM [dbo].[aspnet_UsersInRoles]
  ' 
GO
/****** Object:  View [dbo].[vw_aspnet_WebPartState_Paths]    Script Date: 10/12/2009 10:07:12 ******/

GO
SET QUOTED_IDENTIFIER OFF
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_aspnet_WebPartState_Paths]'))
EXEC dbo.sp_executesql @statement = N'
  CREATE VIEW [dbo].[vw_aspnet_WebPartState_Paths]
  AS SELECT [ApplicationId], 
			[PathId], 
			[Path], 
			[LoweredPath]
  FROM [dbo].[aspnet_Paths]
  ' 
GO
/****** Object:  View [dbo].[vw_aspnet_WebPartState_Shared]    Script Date: 10/12/2009 10:07:12 ******/

GO
SET QUOTED_IDENTIFIER OFF
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_aspnet_WebPartState_Shared]'))
EXEC dbo.sp_executesql @statement = N'
  CREATE VIEW [dbo].[vw_aspnet_WebPartState_Shared]
  AS SELECT [PathId], 
			[DataSize]=DATALENGTH([PageSettings]), 
			[LastUpdatedDate]
  FROM [dbo].[aspnet_PersonalizationAllUsers]
  ' 
GO
/****** Object:  View [dbo].[vw_aspnet_WebPartState_User]    Script Date: 10/12/2009 10:07:12 ******/

GO
SET QUOTED_IDENTIFIER OFF
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_aspnet_WebPartState_User]'))
EXEC dbo.sp_executesql @statement = N'
  CREATE VIEW [dbo].[vw_aspnet_WebPartState_User]
  AS SELECT [PathId], 
			[UserId], 
			[DataSize]=DATALENGTH([PageSettings]), 
			[LastUpdatedDate]
  FROM [dbo].[aspnet_PersonalizationPerUser]
  ' 
GO
